<!DOCTYPE html> 
<html> 
	<head> 
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1"> 
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
		<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
		<link rel="stylesheet" href="/css/page42.css" />
		<script type="text/javascript">
			$(document).ready(function() {
				$(".like_button_img").click(function(evt){
				
					var isbn13 = evt.currentTarget.attributes['isbn13'].nodeValue;
					var src = evt.currentTarget.attributes['src'].nodeValue;
					info ='isbn13='+isbn13
					$.ajax({
						type: 	"POST",
						url: 	"/api/like",
						data:	info,
						success: function(){
							var stat = src;
							if (stat == '/icons/like.png'){
								$('.like_button_img').attr('src', '/icons/like_before.png')
							}else {
								$('.like_button_img').attr('src', '/icons/like.png')
							}
						}
					});
				});
			});
		</script>
		
		<script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>

	</head> 
	<body> 
	<div data-role="page" data-add-back-btn="true" id="page_book">
        <div data-role="header">
            <h1>Book Page</h1>
			 <a href='#' class='ui-btn-left' data-icon='arrow-l' onclick="history.back(); return false">Back</a>
			<a href="/me_edit?{{uid}}" data-icon="gear" class="ui-btn-right">Like</a>
        </div>
        <div data-role="content">
			<ul data-role="listview">
				<li>
					<a href="{{book.infoLink}}">
{% if book.thumbnail_link %}			
					<img src="{{book.thumbnail_link}}" width="50px">
{% endif %}

					<h3 class="notopmargin">{{book.title}}</h3>
					<p>{% for a in book.authors %}<i>{{a}}</i>{% if not forloop.last %}, {% endif %} {% endfor %}<br></p>
					<p>{{book.publishedDate}}; {{book.publisher}} </p>
{% if book.description %}
					<p>{{book.description}}</p>
{% endif %}
					</a>
				</li>
			</ul>
			
{% if bLike %}
			<img src="/icons/like.png" class="like_button_img" isbn13="{{book.ISBN_13}}"/>
{% else %}
			<img src="/icons/like_before.png" class="like_button_img" isbn13="{{book.ISBN_13}}"/></span>
{% endif %}
			<h3>Look Around</h3>
			<ul data-role="listview" data-inset="true"> 
				<li><a href="#">청춘의 문장들<span class="ui-li-count">0</span></a></li> 
				<li><a href="#">밤은노래한다: 김연수장편소설 <span class="ui-li-count">4</span></a></li> 
				<li><a href="#">내 가 아직 아이 였을 때: 김 연수 소설집 <span class="ui-li-count">328</span></a></li> 
				<li><a href="#">세계 의 끝 여자 친구: 김 연수 소설 <span class="ui-li-count">62</span></a></li> 
			</ul> 
		</div>
    </div>
	</body> 
</html> 
 